'''
作者：刘宇轩
文件名称：仿射加密
时间：2021.3.24
'''
print("等比求和")
a = int(input("输入首项:"))
n = int(input("输入项数:"))
q = int(input("输入公比:"))

i = 0
Sn = 0

while i < n:
    Sn = Sn + a
    a = a * q
    i = i + 1
print("Sn =", Sn)
